<!--
 * @Descripttion : 
 * @Autor        : Lilong
 * @Date         : 2022-09-30 11:23:31
 * @LastEditTime : 2022-10-01 06:02:38
 * @FilePath     : \表单控件绑定\v-model和组件\第二种(用于自定义输入组件上)\改变默认的属性名称\配合计算属性一起使用\第二种：原生语法糖和defineComponent\CustomInput.vue
-->
<script lang="ts">
import { computed, defineComponent } from "vue";

export default defineComponent({
    name: 'CustomInput',
    props: ['test'],  
    emits: ['update:test'], 
    setup(props, context) {
        const valueComputed = computed({
            get: () => props.test,
            set: (value) => {
                context.emit('update:test', value)
            } 
        })

        return {
            valueComputed
        }
    }
})
</script>

<template>
    <input v-model="valueComputed">
</template>
